package com.ysd.shopcar.processor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ysd.shopcar.common.BaseProcesser;
import com.ysd.shopcar.common.BaseUtils;
import com.ysd.shopcar.common.JSONResult;
import com.ysd.shopcar.param.in.SubmitOrderRequestType;
import com.ysd.shopcar.param.out.SubmitOrderResponseType;
import com.ysd.shopcar.service.ShopCarService;
@Component
public class SubmitOrderProcessor extends BaseProcesser<SubmitOrderRequestType, SubmitOrderResponseType>{

	@Autowired
	private ShopCarService shopCarService;

	@Override
	protected void validate(SubmitOrderRequestType request) {
		BaseUtils.verifyNotNull(request.getUid(), "Uid不允许为空");
		BaseUtils.verifyNotNull(request.getTotal(), "总金额不允许为空");
		//BaseUtils.verifyNotNull(request.getPoList(), "产品信息不允许为空");
	}
	

	@Override
	protected JSONResult<SubmitOrderResponseType> processing(SubmitOrderRequestType request) throws Exception {
		return shopCarService.submitOrder(request);
	}

}
